how to write mathematical expression in python